~ chicken-core (master) /manual/Module (scheme time)
Trap1[[tags: manual]]2[[toc:]]34== Module (scheme time)56<procedure>(current-second)</procedure>78Returns an inexact number representing the current time on the International9Atomic Time (TAI) scale. The value 0.0 represents midnight on January 1, 197010TAI (equivalent to 8.000082 seconds before midnight Universal Time) and the11value 1.0 represents one TAI second later. Neither high accuracy nor high12precision are required; in particular, returning Coordinated Universal Time13plus a suitable constant might be the best an implementation can do.1415<procedure>(current-jiffy)</procedure>1617Returns the number of jiffies as an exact integer that have elapsed since an18arbitrary, implementation-defined epoch. A jiffy is an implementation-defined19fraction of a second which is defined by the return value of the20jiffies-per-second procedure. The starting epoch is guaranteed to be constant21during a run of the program, but may vary between runs.2223Rationale: Jiffies are allowed to be implementation-dependent so that24current-jiffy can execute with minimum overhead. It should be very likely25that a compactly represented integer will suffice as the returned26value. Any particular jiffy size will be inappropriate for some27implementations: a microsecond is too long for a very fast machine,28while a much smaller unit would force many implementations to29return integers which have to be allocated for most calls, rendering30current-jiffy less useful for accurate timing measurements.3132<procedure>(jiffies-per-second)</procedure>3334Returns an exact integer representing the number of jiffies per SI second. This35value is an implementation-specified constant.3637 (define (time-length)38 (let ((list (make-list 100000))39 (start (current-jiffy)))40 (length list)41 (/ (- (current-jiffy) start)42 (jiffies-per-second))))434445---46Previous: [[Module (scheme repl)]]4748Next: [[Module (scheme write)]]